using UnityEngine;

public class Cat : MonoBehaviour
{
	public StrollController strollController;

	public GameObject milk;

	private Vector2 defaultStrollControllerRadius;

	private Vector2 defaultStrollControllerOffset;

	private void Start()
	{
		InvokeRepeating("FindMilk", 0f, 3f);
		defaultStrollControllerRadius = strollController.radius;
		defaultStrollControllerOffset = strollController.offset;
	}

	public void FindMilk()
	{
		if ((bool)milk)
		{
			return;
		}
		GameObject[] array = GameObject.FindGameObjectsWithTag("Player");
		foreach (GameObject gameObject in array)
		{
			if (gameObject.name == "Milk(Clone)" && gameObject.TryGetComponent<Tool>(out var component) && component.placed)
			{
				milk = gameObject;
				break;
			}
		}
	}

	private void Update()
	{
		if ((bool)milk)
		{
			strollController.followTarget = milk;
			strollController.radius = Vector2.zero;
			strollController.offset = new Vector2(-0.4f, 0f);
		}
		else
		{
			strollController.followTarget = Player.Instance.gameObject;
		}
	}
}
